class JiSuanQi():
    size=20*20
    countKey=30
    isHaveMis=0
    _name='JiSuanQi'
    #类的魔法函数：初始化函数
    #实例即调用
    def __init__(self,n):
        self._name=n
        print("初始化")
    def c_sum(self,a,b):
        if isinstance(a,(int,float)) and isinstance(b,(int,float)):
           c=a+b
           if isinstance(c,float):
               c=round(c,2)
           return c
        elif a=='' or a is None:
            return "第一个数不得为空"
        elif b == '' or b is None:
            return "第二个数不得为空"
        else:
            return "非法输入"
    def c_sub(self,a,b):
        if isinstance(a,(int,float)) and isinstance(b,(int,float)):
            c = a - b
            if isinstance(c, float):
                c = round(c, 2)
            return c
        elif a=='' or a is None:
            return "第一个数不得为空"
        elif b == '' or b is None:
            return "第二个数不得为空"
        else:
            return "非法输入"
    def c_chen(self,a,b):
        if isinstance(a,(int,float)) and isinstance(b,(int,float)):
            c = a * b
            if isinstance(c, float):
                c = round(c, 2)
            return c
        elif a=='' or a is None:
            return "第一个数不得为空"
        elif b == '' or b is None:
            return "第二个数不得为空"
        else:
            return "非法输入"
    def c_chu(self,a,b):
        if isinstance(a,(int,float)) and isinstance(b,(int,float)) and b!=0:
            c = a / b
            if isinstance(c, float):
                c = round(c, 2)
            return c
        elif a=='' or a is None:
            return "第一个数不得为空"
        elif b == '' or b is None:
            return "第二个数不得为空"
        else:
            return "非法输入"

    #私有方法
if __name__ == '__main__':
    js=JiSuanQi("myjisuanqi")
    print(js.c_sum(1,'abc'))
    print(js.c_sum(-1, -9))
    print(js.c_sub(5.123,1))
    print(js.c_chen(2,2))
    print(js.c_chu(10,2))